package com.framework
{
	import flash.display.Graphics;
	import flash.display.SimpleButton;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	

	public class BasicButton extends Sprite
	{
		//test
		protected var buttonBG:Sprite; 
		protected var _id:int;
		protected var _btnName:int;
		
		//text for button 
		public  var txtButtonName:TextField = new TextField;
		
		public function BasicButton()
		{

			this.addEventListener(Event.ADDED_TO_STAGE,init);
			
		}
		

		public function get btnName():int
		{
			return _btnName;
		}

		public function set btnName(value:int):void
		{
			_btnName = value;
		}



		public function get id():int
		{
			return _id;
		}

		public function set id(value:int):void
		{
			_id = value;
		}
		
		
		

		public function draw(x:int,y:int):void
		{
						
		}
		
		public function init(e:Event=null):void
		{
		//	buttonBG = new resButtonTest;
		//	buttonBG.x = 0;
		//	buttonBG.y = 0;
		//	addChild(buttonBG);
		//	addChild(txtButtonName);
		//	txtButtonName.selectable = false;
		}
		
		public function update():void
		{
			
		}
		
		public function addButtonEventListener():void
		{

			this.buttonMode = true;
			this.addEventListener(MouseEvent.CLICK,buttonEventDispathcer);
			
		}
		
		public function setText(str:String):void
		{
			txtButtonName.text = str;
			
		}
		
		public function buttonEventDispathcer(e:MouseEvent):void
		{
			dispatchEvent(new CustomEventButton(CustomEventButton.BUTTON_ID,_btnName,_id));
		//	this.removeEventListener(MouseEvent.CLICK,buttonEventDispathcer);
			
		}
		
	
		  
	}
}